package com.jack.cms.modular.system.controller;

import java.util.List;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.google.common.collect.Lists;
import com.jack.cms.common.constant.tips.Tip;
import com.jack.cms.common.controller.BaseController;
import com.jack.cms.common.persistence.model.User;
import com.jack.cms.core.support.HttpKit;
import com.jack.cms.modular.system.api.TestApi;

@RestController
public class TestController extends BaseController implements TestApi {

	public Tip<List<User>> list(@RequestBody(required = false) String name) {
		log.info(name);
		List<User> lists = Lists.newArrayList();
		lists.add(new User());
		return HttpKit.success(lists);
	}

	public Tip<User> create(@RequestBody User user) {
		log.info(user);
		return HttpKit.success(user);
	}

	public Tip<User> update(@RequestBody User user) {
		log.info(user);
		return HttpKit.success(user);
	}

	public Tip<User> byId(@RequestBody @PathVariable(value = "id") String id) {
		log.info(id);
		return HttpKit.success(new User());
	}

	public Tip<Object> delete(@RequestBody @PathVariable(value = "id") String id) {
		log.info(id);
		return HttpKit.success();
	}

}
